<template>
  <div class="page-container" style="min-width: 1170px;">
    <ex_header_spiler :title="$t('label_base_info')" />
    <ex_super_desc :model="baseOption" :data="form" size="default" direction="vertical" :attrs="$defaultDetailDescAttrs" border
      class="desc_flex_row" labelClassName="flex_cell" contentClassName="flex_cell"></ex_super_desc>

    <ex_header_spiler :title="$t('label_base_contact_info')" />
    <ex_super_desc :model="baseOption2" :data="form" size="default" direction="vertical" :attrs="$defaultDetailDescAttrs" border
      class="desc_flex_row" labelClassName="flex_cell" contentClassName="flex_cell"></ex_super_desc>
  </div>
</template>

<script>
const default_obj = {
  omsPurchaseOrderDetailList: []
}
import role_system_mixin from '@/mixin/role_system_mixin';
import router_params from '@/mixin/router_params';
import history_purchase_order_dialog from "@/page/oms/purchase/dialog/history_purchase_order_dialog.vue"

export default {
  title: 'purchase_order_detail',
  mixins: [router_params, role_system_mixin],
  components: {
    history_purchase_order_dialog
  },
  props: {
  },
  data() {
    return {
      loading: false,
      form: _.cloneDeep(default_obj),
      baseOption: [
        {
          key: "customerName",
          label: "label_customer",
        },
        {
          key: "platformType",
          label: "label_supplier_platform_type",
          formatter: (r, c, v, i) => this.$enumShow(v, "PurchasePlatformTypeEnum"),
        },
        {
          key: "settleMethod",
          label: "label_supplier_means_payments",
          formatter: (r, c, v, i) => this.$enumShow(v, "SupplierSettleMethodEnum"),
        },
        {
          key: "systemDefault",
          label: "label_supplier_system_default",
          formatter: (r, c, v, i) => this.$enumShow(v, "YesOrNoEnum"),
        },
        {
          key: "supplierName",
          label: "label_supplier_good_name",
        },
        {
          key: "supplierCode",
          label: "label_supplier_vendor_code",
        }, {
          key: "homepageUrl",
          label: "label_supplier_homepage_url",
        }, {
          key: "companyAddress",
          label: "label_supplier_company_address",
        }, {
          key: "remark",
          label: "label_supplier_postscript",
        }
      ],
      baseOption2: [
        {
          key: "contacter",
          label: "label_supplier_contacts",
        },
        {
          key: "contacterPhone",
          label: "label_supplier_phone",
        },
        {
          key: "email",
          label: "label_supplier_mailbox",
        }, {
          key: "qq",
          label: "QQ",
        }, {
          key: "bankName",
          label: "label_supplier_bank_card_name",
        }, {
          key: "bankAccount",
          label: "label_supplier_bank_card_account",
        }, {
          key: "paymentMethod",
          label: "label_supplier_payment_method",
          formatter: (r, c, v, i) => this.$enumShow(v, "SupplierPaymentMethodEnum"),
        }, {
          key: "payer",
          label: "label_supplier_payee"
        }
      ]
    }
  },
  methods: {
    fixTabLabel() {
      this.$emit("tagModifyLabel", { _key: 'label_name_code', i18n: { name: true }, name: "label_add_supplier_details", code: this.form.supplierName })
    },
    init_order(id) {
      this.loading = true
      let data = {
        id
      }
      this.$ajax({
        url: "/oms-api/purchase/OmsPurchaseSupplierRpc/selectDetail.json",
        method: 'post',
        data,
        success: (res) => {
          if (!res.data) return this.$message.error(this.$tt("label_data_loss"))
          this.form = res.data
          this.loading = false
          this.fixTabLabel()
        },

      })
    },
    init_data_default(params) {
      this.init_order(params.id)
    },

  },
  destroyed() {

  }
};
</script>

<style lang="less" scoped>
/deep/.cubs {
  color: #2ea7e0;
  cursor: pointer;
}
</style>
